// MESSAGE KALMAN_DATA_Z support class

#pragma once

namespace mavlink {
namespace fppa {
namespace msg {

/**
 * @brief KALMAN_DATA_Z message
 *
 * KALMAN_DATA_Z
 */
struct KALMAN_DATA_Z : mavlink::Message {
    static constexpr msgid_t MSG_ID = 23;
    static constexpr size_t LENGTH = 172;
    static constexpr size_t MIN_LENGTH = 172;
    static constexpr uint8_t CRC_EXTRA = 215;
    static constexpr auto NAME = "KALMAN_DATA_Z";


    std::array<float, 6> zk; /*<  measure observe */
    std::array<float, 6> hk; /*<  measure prediction */
    std::array<float, 6> vk; /*<  measure deviation */
    std::array<float, 6> R; /*<  measure noise */
    std::array<float, 6> lambda; /*<   Strong tracking filter lambda  */
    std::array<float, 13> P0; /*<  covariance */


    inline std::string get_name(void) const override
    {
            return NAME;
    }

    inline Info get_message_info(void) const override
    {
            return { MSG_ID, LENGTH, MIN_LENGTH, CRC_EXTRA };
    }

    inline std::string to_yaml(void) const override
    {
        std::stringstream ss;

        ss << NAME << ":" << std::endl;
        ss << "  zk: [" << to_string(zk) << "]" << std::endl;
        ss << "  hk: [" << to_string(hk) << "]" << std::endl;
        ss << "  vk: [" << to_string(vk) << "]" << std::endl;
        ss << "  R: [" << to_string(R) << "]" << std::endl;
        ss << "  lambda: [" << to_string(lambda) << "]" << std::endl;
        ss << "  P0: [" << to_string(P0) << "]" << std::endl;

        return ss.str();
    }

    inline void serialize(mavlink::MsgMap &map) const override
    {
        map.reset(MSG_ID, LENGTH);

        map << zk;                            // offset: 0
        map << hk;                            // offset: 24
        map << vk;                            // offset: 48
        map << R;                             // offset: 72
        map << lambda;                        // offset: 96
        map << P0;                            // offset: 120
    }

    inline void deserialize(mavlink::MsgMap &map) override
    {
        map >> zk;                            // offset: 0
        map >> hk;                            // offset: 24
        map >> vk;                            // offset: 48
        map >> R;                             // offset: 72
        map >> lambda;                        // offset: 96
        map >> P0;                            // offset: 120
    }
};

} // namespace msg
} // namespace fppa
} // namespace mavlink
